const app = getApp();
Page({

  /**
   * 页面的初始数据
   */
  data: {
    youhuihouseList:null,
    curpage: 1,
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    wx.showLoading();
    this.getcouponList();
  },

  //上拉加载
  onReachBottom: function () {
    this.getcouponList();
  },

  //获取优惠楼盘列表
  getcouponList:function(){
    wx.showLoading({
      title:'努力加载中...',
      mask: true,
    });
    var vm = this;
    var cityId = app.globalData.cityCode;
    var limit = '10';
    var url = "get_youhui_houses/site_id/" + cityId + "/limit/" + limit;
    app.core('get', url, {
    }, (res) => {
      setTimeout(function () {
        wx.hideLoading()
      }, 1000)
      var data1 = vm.data.youhuihouseList;
      if (data1 == null) {
        vm.setData({
          youhuihouseList: res.data
        });
       
        return;
      }
     
      for (var i = 0; i < res.data.length; i++) {
        data1.push(res.data[i]);
      }
      vm.setData({
        youhuihouseList: data1
      })
    },
      (err) => {
        console.log(err)
      }
    )
  },

//获取详情
  gotoDesc:function(e){
    wx.navigateTo({
      url: e.currentTarget.dataset.url
    });
  }

})